﻿<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <title>Bootstrap 101 Template</title>

    <!-- Bootstrap -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" rel="stylesheet">

    <!-- HTML5 shim 和 Respond.js 是为了让 IE8 支持 HTML5 元素和媒体查询（media queries）功能 -->
    <!-- 警告：通过 file:// 协议（就是直接将 html 页面拖拽到浏览器中）访问页面时 Respond.js 不起作用 -->
    <!--[if lt IE 9]>
      <script src="https://cdn.jsdelivr.net/npm/html5shiv@3.7.3/dist/html5shiv.min.js"></script>
      <script src="https://cdn.jsdelivr.net/npm/respond.js@1.4.2/dest/respond.min.js"></script>
    <![endif]-->
</head>
<body>
    <h1>你好，世界！</h1>
    <button class="btn btn-info" onclick="cefCustomObject.showDevTools();">浏览器调试工具</button>

    <button class="btn btn-primary" onclick="cefCustomObject.opencmd();">本地命令行工具</button>
    <button class="btn btn-primary" id="test">对话框</button>
    <button class="btn btn-primary" onclick="findComputerInfo()">获取电脑信息</button>
    <button class="btn btn-primary" onclick="cefCustomObject.closeForm();">关闭窗体</button>

    <ul id="msg"></ul>

    <!-- Button trigger modal -->
    <button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">
        Launch demo modal
    </button>

    <!-- Modal -->
    <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="myModalLabel">Modal title</h4>
                </div>
                <div class="modal-body">
                    test
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                    <button type="button" class="btn btn-primary">Save changes</button>
                </div>
            </div>
        </div>
    </div>

    <!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery，所以必须放在前边) -->
    <script src="https://cdn.jsdelivr.net/npm/jquery@1.12.4/dist/jquery.min.js"></script>
    <!-- 加载 Bootstrap 的所有 JavaScript 插件。你也可以根据需要只加载单个插件。 -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js"></script>
    <script type="text/javascript">

        $(document).ready(function () {
            $('#test').on('click', function () {
                alert('test');
            });
        });

        //调用C#方法后的回调函数：显示电脑信息
        //data为C#方法返回的数据
        function callback(data) {
            data = JSON.parse(data);
            $("#msg").html('');
            $("#msg")
                .append($("<li>cpu_id:" + data.cpu_id + "</li>"))
                .append($("<li>disk_id:" + data.disk_id + "</li>"))
                .append($("<li>host_name:" + data.host_name + "</li>"))
                .append($("<li>networkcard:" + data.networkcard + "</li>"))
                .append($("<li>serialNumber:" + data.serialNumber + "</li>"))
                .append($("<li>manufacturer:" + data.manufacturer + "</li>"))
                .append($("<li>product:" + data.product + "</li>"));
        };

        function findComputerInfo() {
            //调用后台C#FindComputerInfo，返回结果回调方法callback
            cefCustomObject.findComputerInfo(callback);
        };

    </script>
</body>
</html>